# -*- coding: utf-8 -*-
# @version : 1.0
# @File    : role.py
# @Date    : 2024/9/13 14:13
# @Author  : GlenZhao
# @Desc    : 角色模型
from sqlalchemy.orm import Mapped, mapped_column
from sqlalchemy import String, Integer, Boolean

from db.base import BaseModel


class AuthRole(BaseModel):
    __tablename__ = "auth_role"
    __table_args__ = ({'comment': '角色表'})

    name: Mapped[str] = mapped_column(String(50), index=True, comment="名称")
    role_key: Mapped[str] = mapped_column(String(50), index=True, comment="权限字符")
    data_range: Mapped[int] = mapped_column(Integer, default=4, comment="数据权限范围")
    disabled: Mapped[bool] = mapped_column(Boolean, default=False, comment="是否禁用")
    order: Mapped[int | None] = mapped_column(Integer, comment="排序")
    desc: Mapped[str | None] = mapped_column(String(255), comment="描述")
    is_admin: Mapped[bool] = mapped_column(Boolean, comment="是否为超级角色", default=False)
